/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package collision;

import javax.swing.JFrame;

/**
 *
 * @author iRina
 */
public class Menu {
    private JFrame frame = new JFrame();
    private InFrame menu;
    private boolean end;
    private int choose;
    private int add;
    
    public Menu(JFrame frame){
        this.frame = frame;
        end = false;
        choose = 0;
        
        menu = (StartMenu) new StartMenu();
        frame.add(menu);
        frame.setVisible(true);
        MenuControl(this.frame);
        
    }
    
    private void MenuControl(JFrame frame){
        
        while(!end){
            
            if(menu.getFinished() == 3){
               frame.remove(menu);
               menu = new StartMenu();
               menu.setFinished(0);
               frame.add(menu);
            }
            
            if(menu.getFinished() == 1){
                System.out.println("Entrou =)");
                menu.removeAll();
                frame.remove(menu);
                frame = new PokemonVsZombies();
                menu = (Board) new Board(640,500);
                menu.setFinished(0);
                frame.setVisible(true);
            }
            
            if(menu.getFinished() == 2){
                frame.remove(menu);
                menu = new Credits();
                System.exit(0);
            }
            
            frame.setVisible(true);
            
               
        }
        
    }
    
}
